package com.iphanta.community.user.web.admin;

import com.iphanta.community.common.entity.DataResult;
import com.iphanta.community.common.utils.ResultUtils;
import com.iphanta.community.user.service.AdminUserService;
import com.iphanta.community.user.traffic.admin.ModifyUserRequest;
import com.iphanta.community.user.traffic.admin.ModifyUserResponse;
import com.iphanta.community.user.traffic.admin.QueryUserRequest;
import com.iphanta.community.user.traffic.admin.QueryUserResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 后台管理 - 用户
 *
 * @author 墨声 E-mail: zehong.hongframe.huang@gmail.com
 * create time: 4/22/22 6:37 PM
 */
@RestController
@RequestMapping("community/admin/user/")
public class AdminUserController {

    @Autowired
    private AdminUserService adminUserService;

    /**
     * 查询
     *
     * @param request
     * @return
     */
    @PostMapping("query")
    public DataResult<QueryUserResponse> query(@RequestBody QueryUserRequest request) {
        return ResultUtils.SUCCESS.result(this.adminUserService.query(request));
    }

    /**
     * 修改
     *
     * @param request
     * @return
     */
    @PostMapping("modify")
    public DataResult<ModifyUserResponse> modify(@RequestBody ModifyUserRequest request) {
        return ResultUtils.SUCCESS.result(this.adminUserService.modify(request));
    }

}
